package Ramdom;
/*
*猜数字小游戏
* */
import java.util.Random;
import java.util.Scanner;

public class Ramdom2 {

    public static void main(String[] args) {
        Random r = new Random();
        int randomnum = r.nextInt(100)+1;
        Scanner sc = new Scanner(System.in);

        while(true){
            System.out.print("请输入你猜测的数字：");
            int guessnum = sc.nextInt();
            if(guessnum > randomnum){
                System.out.println("偏大！");
            }else if (guessnum < randomnum){
                System.out.println("偏小！");
            }else{
                System.out.println("猜中了！!!");
                break;
            }
        }

        System.out.println("游戏结束！");
    }
}
